import java.io.File;
import java.util.Date;

import javax.swing.JOptionPane;

import org.apache.log4j.PropertyConfigurator;

import constants.Constants;
import controller.impl.ControlImp;

import util.Helper;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		File arq = new File("C://sisgercon//conf//log4j.properties");

		if(arq.exists()){
			System.setProperty("timestamp", Helper.getDateAsFormattedStringSeparator(new Date(),Constants.SIMPLE_DATE_FORMAT_yyyyMMdd));
            PropertyConfigurator.configure("C://sisgercon//conf//log4j.properties");
			ControlImp controller = ControlImp.getInstance();
			controller.allInvisible();
			controller.getFrame().getJMenuBar1().setVisible(false);
			controller.getFrame().getInternalFLogin().setVisible(true);
			controller.getFrame().setVisible(true);
		}
		else{
			JOptionPane.showMessageDialog(null, "Erro ao carregar o arquivo de configuracao. \n\nEntre em contato com o administrador. \n\n O programa sera finalizado!",
					"Erro",JOptionPane.ERROR_MESSAGE);
			System.exit(1);
		}
	}
}
